<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { showToast } from 'vant'

const router = useRouter()

const recommendations = ref([
  { title: '个性化推荐', desc: '根据您的旅行偏好', icon: '🎯' },
  { title: 'Coze聊天', desc: '智能对话助手', icon: '💬', route: '/coze-chat' },
  { title: 'Dify聊天', desc: '智能对话助手', icon: '💬', url: 'https://udify.app/workflow/DQEfb787q6n6T7cr' },
  { title: 'Rag', desc: '智能问答助手', icon: '🤖', route: '/rag-chat' }
])

const handleRecommend = (item) => {
  if (item.url) {
    window.open(item.url, '_blank')
  } else if (item.route) {
    router.push(item.route)
  } else {
    showToast(`${item.title}功能开发中`)
  }
}
</script>

<template>
  <div class="ai-recommend-page">
    <div class="page-header">
      <h1 class="page-title">AI智能推荐</h1>
      <p class="page-subtitle">让AI成为您的旅行助手</p>
    </div>

    <div class="recommendations-grid">
      <div
        v-for="item in recommendations"
        :key="item.title"
        class="recommend-card"
        @click="handleRecommend(item)"
      >
        <div class="card-icon">{{ item.icon }}</div>
        <div class="card-title">{{ item.title }}</div>
        <div class="card-desc">{{ item.desc }}</div>
      </div>
    </div>

    <div class="feature-section">
      <h2 class="section-title">智能功能</h2>
      <div class="feature-list">
        <div class="feature-item">
          <div class="feature-icon">🤖</div>
          <div class="feature-content">
            <div class="feature-title">智能行程规划</div>
            <div class="feature-desc">根据您的偏好和时间，AI自动规划最佳旅行路线</div>
          </div>
        </div>
        <div class="feature-item">
          <div class="feature-icon">💰</div>
          <div class="feature-content">
            <div class="feature-title">价格预测</div>
            <div class="feature-desc">实时分析价格趋势，推荐最佳预订时机</div>
          </div>
        </div>
        <div class="feature-item">
          <div class="feature-icon">🎨</div>
          <div class="feature-content">
            <div class="feature-title">个性化推荐</div>
            <div class="feature-desc">基于大数据分析，为您推荐最符合喜好的目的地</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.ai-recommend-page {
  min-height: 100vh;
  background: #f5f5f5;
  padding: 16px;
  padding-bottom: 100px;
}

.page-header {
  text-align: center;
  padding: 20px 0;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: #666;
}

.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.recommend-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.recommend-card:active {
  transform: scale(0.98);
}

.card-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 12px;
  color: #999;
}

.feature-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}

.feature-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.feature-content {
  flex: 1;
}

.feature-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}
</style>

